import Taro, { Component } from '@tarojs/taro'
import { View, Swiper, SwiperItem } from '@tarojs/components'
import SwiperCard from '../swiperCard/index'
import './index.scss'

export default class HotSwiper extends Component {
  constructor (props) {
    super(props);
    this.state = {

    }
  }

  componentDidMount () {
    console.log(this.props.data)
  }

  render() {
    const {data} = this.props;
    if (data) {
      return (
        <View className='swiper-content'>
          <Swiper
            className='swiper'
            indicatorColor='#eee'
            indicatorActiveColor='#39958C'
            circular
            indicatorDots
            autoplay
          >
            {
              data.map((item , index) => {
                return (
                  <SwiperItem key={index}>
                    <SwiperCard
                      item={item}
                    />
                  </SwiperItem>
                )
              })
            }
          </Swiper>
        </View>
      );
    }
    return null
  }
}
